﻿using System;
using System.Collections.Generic;
using System.Linq;
using QL_LichCT.Entities;
using System.Data;

namespace QL_LichCT.DataLayer
{
    class BOMONDAL
    {
        public static List<BOMON> GetList()
        {
            DataAccessHelper db = new DataAccessHelper();
            DataTable dt = db.GetDataTable("select * from BOMON");

            List<BOMON> list = new List<BOMON>();

            foreach (DataRow row in dt.Rows)
                list.Add(new BOMON(row));
            return list;
        }

        public static object GetColumnByTC(string column, string tc, object value)
        {
            DataAccessHelper db = new DataAccessHelper();

            string sql = string.Format("select {0} from BoMon where {1} = {2}", column, tc, value);
            object kq = db.GetVaule(sql);
            return kq;
        }
    }
}
